package net.loyintean.pearlshell.validation.rule;

import net.loyintean.pearlshell.validation.IValidRule;
import net.loyintean.pearlshell.validation.IValidRuleConfig;

class StringIsFloatValidRuleImpl extends AbstractStringValidRuleImpl implements
		IValidRule {

	StringIsFloatValidRuleImpl() {
		super();
	}

	@Override
	public boolean validString(String toValid, IValidRuleConfig config) {

		try {
			Float.valueOf(toValid);

		} catch (NumberFormatException e) {
			return false;
		}
		return true;
	}

	@Override
	public String errorMsg(IValidRuleConfig config) {
		return "不是数字格式";
	}
}
